package com.hayato.demo.client.Info;

import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.hayato.demo.client.model.ProductModel;

@PersistenceCapable
public class ProductInfo {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private String product_name;

	@Persistent
	private Double unit_price;

	@Persistent
	private int capacity;

	@Persistent
	private Date date_created;

	@Persistent
	private Date date_updated;
	
	@Persistent
	private Long category2Id;

	public ProductInfo() {
	}

	public ProductInfo(String productname, Double unitprice, int capacity,
			Date create, Date update) {
		this.product_name = productname;
		this.unit_price = unitprice;
		this.capacity = capacity;
		this.date_created = create;
		this.date_updated = update;
	}

	public Long getId() {
		return id;
	}

	public String getProduct_name() {
		return product_name;
	}

	public void setProduct_name(String product_name) {
		this.product_name = product_name;
	}

	public Double getUnit_price() {
		return unit_price;
	}

	public void setUnit_price(Double unit_price) {
		this.unit_price = unit_price;
	}

	public int getCapacity() {
		return capacity;
	}

	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}

	public Date getDate_created() {
		return date_created;
	}

	public void setDate_created(Date date_created) {
		this.date_created = date_created;
	}

	public Date getDate_updated() {
		return date_updated;
	}

	public void setDate_updated(Date date_updated) {
		this.date_updated = date_updated;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public ProductModel toModel() {
		ProductModel model = new ProductModel();
		model.setId(id);
		model.setProductName(product_name);
		model.setCapacity(capacity);
		model.setUnitprice(unit_price);
		return model;
	}

	public Long getCategory2Id() {
		return category2Id;
	}

	public void setCategory2Id( Long category2Id ) {
		this.category2Id = category2Id;
	}
}
